package mx.com.switz.autopista.dao.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import mx.com.switz.autopista.dto.Vehiculo;

import org.springframework.jdbc.core.RowMapper;

public class VehiculoRowMapper implements RowMapper<Vehiculo> {

	public Vehiculo mapRow(ResultSet rs, int rowNum) throws SQLException {

		Vehiculo vehiculo = new Vehiculo();
		vehiculo.setIdVehiculo(rs.getString("v.id_vehiculo"));
		vehiculo.setTitulo(rs.getString("v.titulo"));
		vehiculo.setPrecio(rs.getInt("v.precio"));
		vehiculo.setFoto(rs.getString("vf.url_foto"));
		vehiculo.setMunicipio(rs.getString("m.nombre_municipio"));
		vehiculo.setFechaAlta(rs.getDate("v.fecha_alta"));
		return vehiculo;
	}

}